<!DOCTYPE html><html lang="en"><head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Vue</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="/css/common.css">
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>
</head><body>
<div id="app">
    <button @click="doActioned">计算</button>
    <div>{{ result }}</div>
</div>
<script type="text/javascript">
    const BaseFun = {
        created: function () { console.log('实例被创建了') },
        methods: {
            doDesc: function (a) {
                return JSON.stringify(a)
            }
        }
    }
    const app = new Vue({ el: '#app',
        data: { valueA: {name: 'Jim'}, result: '-' },
        methods: {
            doActioned: function () {
                this.result = this.doDesc(this.valueA)
            }
        },
        extends: BaseFun
    })
</script></body></html>
